/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// pcbdial.hpp - Interface for the PegCircularBitmapDial class
//
// Author: Jim DeLisle
//
// Copyright (c) 1997-2000 Swell Software
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software
// is strictly prohibited.
//
// Notes:
//
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef _PCBDIAL_HPP_
#define _PCBDIAL_HPP_


/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
class PegCircularBitmapDial : public PegCircularDial
{
    public:
        PegCircularBitmapDial(const PegRect& Rect, PEGINT RefAngle,
                              PEGLONG ValuePerRev, PEGLONG MinValue,
                              PEGLONG MaxValue, PEGINT BkgBitmap,
                              PEGINT AnchorBitmap = 0,
                              PEGULONG Style = DS_STANDARDSTYLE);

        virtual ~PegCircularBitmapDial();

        virtual void Draw(const PegRect &Invalid);

        PEGINT GetBitmap(PEGINT Index) const
        {
            if (Index)
            {
                return mAnchorBitmap;
            }
            else
            {
                return mBkgBitmap;
            }
        }

        PEGINT GetBkgBitmap() const { return mBkgBitmap; }
        PEGINT GetCORX() const { return mCOR.x; }
        PEGINT GetCORY() const { return mCOR.y; }

        virtual void Resize(const PegRect &Size);

        void SetBitmap(PEGINT Index, PEGINT BmpId)
        {
            if (Index)
            {
                mAnchorBitmap = BmpId;
            }
            else
            {
                mBkgBitmap = BmpId;
            }
        }

        void SetCOR(PEGINT CORX, PEGINT CORY, PEGBOOL Redraw = FALSE);

        void UseTrueCOR(PEGBOOL Use);

    protected:
        virtual void CalcNeedlePos();
        void DrawToComposite(const PegRect &Invalid);

        PegPoint   mCOR;

        PEGINT mBkgBitmap;
        PEGINT mAnchorBitmap;
        PEGINT mPrivSurface;

};

#endif // _PCBDIAL_HPP_

